{% extends "base.html" %}

{% block title %}抽题系统 - 管理员登录{% endblock %}

{% block content %}
<div class="container">
    <div class="row justify-content-center align-items-center min-vh-100">
        <div class="col-md-6 col-lg-4">
            <div class="card shadow-lg border-0 rounded-lg">
                <div class="card-header bg-primary text-white text-center py-4">
                    <h3 class="mb-0">管理员登录</h3>
                </div>
                <div class="card-body p-4">
                    <form method="POST" action="{{ url_for('admin.login') }}">
                        {{ form.hidden_tag() }}
                        <div class="mb-3">
                            <label for="username" class="form-label">用户名</label>
                            <div class="input-group">
                                <span class="input-group-text"><i class="bi bi-person"></i></span>
                                {{ form.username(class="form-control", placeholder="请输入用户名") }}
                            </div>
                            {% if form.username.errors %}
                            <div class="invalid-feedback d-block">
                                {% for error in form.username.errors %}
                                {{ error }}
                                {% endfor %}
                            </div>
                            {% endif %}
                        </div>
                        <div class="mb-4">
                            <label for="password" class="form-label">密码</label>
                            <div class="input-group">
                                <span class="input-group-text"><i class="bi bi-lock"></i></span>
                                {{ form.password(class="form-control", placeholder="请输入密码") }}
                            </div>
                            {% if form.password.errors %}
                            <div class="invalid-feedback d-block">
                                {% for error in form.password.errors %}
                                {{ error }}
                                {% endfor %}
                            </div>
                            {% endif %}
                        </div>
                        <div class="d-grid">
                            {{ form.submit(class="btn btn-primary btn-lg") }}
                        </div>
                    </form>
                    {% with messages = get_flashed_messages() %}
                    {% if messages %}
                    <div class="alert alert-danger mt-3 mb-0">
                        {% for message in messages %}
                        {{ message }}
                        {% endfor %}
                    </div>
                    {% endif %}
                    {% endwith %}
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block styles %}
<style>
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    border-top-left-radius: 15px !important;
    border-top-right-radius: 15px !important;
    background: linear-gradient(45deg, #4e73df, #224abe);
    border: none;
}

.card-body {
    background-color: #fff;
}

.form-control {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border: 1px solid #e3e6f0;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.input-group-text {
    background-color: #f8f9fc;
    border: 1px solid #e3e6f0;
    border-radius: 8px 0 0 8px;
}

.btn-primary {
    background: linear-gradient(45deg, #4e73df, #224abe);
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(78, 115, 223, 0.3);
}

.alert {
    border-radius: 8px;
    border: none;
}

.invalid-feedback {
    color: #e74a3b;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-label {
    font-weight: 600;
    color: #5a5c69;
    margin-bottom: 0.5rem;
}
</style>
{% endblock %} 